<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                template="/templates/ui.xhtml">

    <ui:define name="head">
        <style type="text/css">
            .col-95 {
                text-align: right;
            }

            .col-5 {
                text-align: left;
            }

            .col-80 {
            }

            .col-20 {
                width: 5%;
            }
        </style>
        <script type="text/javascript">
            function doPopupWindow(obj) {
                var queue = obj.parentNode.parentNode.childNodes[0].childNodes[0].innerHTML;
                popupwindow = window.open("queueMessages.xhtml?queue=" + queue, "popupwindow", "height=400,width=800,left=300,top=200,toolbar=no,menubar=no,scrollbars=yes,location=no");
                popupwindow.focus;
            }
        </script>

    </ui:define>

    <ui:define name="content">
        <div style="margin:5px;">
            <p:growl id="msgs" showDetail="false"/>
            <h:form>
                <p:panel header="消息服务器基本信息">
                        <h:panelGrid columns="3" cellpadding="10">
                            <p:graphicImage value="/images/dep/activemq.png"/>
                            <h:panelGroup style="font-size: 13px;text-align: left">
                                <h:outputText value="Broker：" style="width:150px;"/><br/>
                                <h:outputText value="主机名："/><br/>
                                <h:outputText value="版本："/><br/>
                                <h:outputText value="URL："/><br/>
                            </h:panelGroup>
                            <h:panelGroup style="font-size: 13px;text-align: left">
                                <h:outputText value="#{sysQueueAction.brokerViewMBean.brokerId}" /><br/>
                                <h:outputText value="#{sysQueueAction.brokerViewMBean.brokerName}"/><br/>
                                <h:outputText value="#{sysQueueAction.brokerViewMBean.brokerVersion}"/><br/>
                                <h:outputText value="#{sysQueueAction.brokerViewMBean.openWireURL}"/><br/>
                            </h:panelGroup>
                        </h:panelGrid>
                </p:panel>
                    <p:fieldset legend="消息服务器远程连接状态" toggleable="true" toggleSpeed="500">
                        <br/>
                        <p:dataTable id="pdt" style="width:100%;"
                                     dynamic="true"
                                     value="#{sysQueueAction.connViewList}" var="record"
                                     paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                                     paginator="true" rows="5" paginatorPosition="bottom"
                                     rowsPerPageTemplate="100,50,30,10,5"
                                     emptyMessage="数据记录为空...">

                            <p:column headerText="远程地址" style="text-align:center">
                                <h:outputText value="#{record.remoteAddress}"/>
                            </p:column>
                            <p:column headerText="激活" style="text-align:center">
                                <h:outputText value="#{sysQueueAction.getBoolStatus(record.active)}"/>
                            </p:column>
                            <p:column headerText="阻塞状态" style="text-align:center">
                                <h:outputText value="#{sysQueueAction.getBoolStatus(record.blocked)}"/>
                            </p:column>
                            <p:column headerText="已连接" style="text-align:center">
                                <h:outputText value="#{sysQueueAction.getBoolStatus(record.connected)}"/>
                            </p:column>
                        </p:dataTable>
                    </p:fieldset>
                    <p:fieldset legend="消息服务器队列状态" toggleable="true" toggleSpeed="500">
                        <br/>
                        <p:dataTable id="pdt2" style="width:100%;"
                                     dynamic="true"
                                     value="#{sysQueueAction.queueViewList}" var="record"
                                     paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                                     paginator="true" rows="5" paginatorPosition="bottom"
                                     rowsPerPageTemplate="100,50,30,10,5"
                                     emptyMessage="数据记录为空...">

                            <p:column headerText="队列名" style="text-align:left">
                                <p:commandLink value="#{record.name}" style="color:blue" update="popupwindow"
                                                   onclick="doPopupWindow(this);"/>
                            </p:column>
                            <p:column headerText="生产者数" style="text-align:center">
                                <h:outputText value="#{record.producerCount}"/>
                            </p:column>
                            <p:column headerText="消费者数" style="text-align:center">
                                <h:outputText value="#{record.consumerCount}"/>
                            </p:column>
                            <p:column headerText="入列消息数" style="text-align:center">
                                <h:outputText value="#{record.enqueueCount}"/>
                            </p:column>
                            <p:column headerText="出列消息数" style="text-align:center">
                                <h:outputText value="#{record.dequeueCount}"/>
                            </p:column>

                        </p:dataTable>
                    </p:fieldset>
            </h:form>
        </div>
    </ui:define>

</ui:composition>